# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        博智科技  
# Name:         demo31
# Description:
# Author:       yzl
# Date:         2019-02-03
#-------------------------------------------------------------------------------

# 1 值传递
# a = 1
# b = 2
# print('外部a',id(a))
# def add(a,b):
#     print('参数a',id(a))
#     a = a + 1
#     print('内部a',id(a))
#     b = b + 1
#     print('add函数内部:')
#     print('a=',a)
#     print('b=',b)
#
# add(a,b)
# print(id(a))
# print('add函数外部')
# print('a=',a)
# print('b=',b)


# 2 引用传递
l1 = [1,2]
print('外部:',id(l1))
def add2(list):
    print('add2函数内部:')
    print('内部',id(list))
    list[0] = list[0] + 10
    list[1] = list[1] + 20
    print(list)

add2(l1)
print('add2函数外部')
print(l1)

# def add3(a,b):
#     # list[0] = list[0] + 100
#     # list[1] = list[1] + 100
#     a = a + 100
#     print(a)
#
# add3(*l1)
#
# def jc(n):
#     if n == 0 or n == 1:
#         return 1
#     else:
#         return n * jc(n -1)
#
# print(jc(100))
